<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/views/common/includetag.jsp"%>
<c:set var="yes_img" value="${ctx}/static/images/common/accept.png"/>
<c:set var="no_img" value="${ctx}/static/images/common/cancel.png"/>
<!DOCTYPE html>
<html lang="en_US">
    <head>
        <title><spring:message code="app.batch.title" /></title>
		<link rel="stylesheet" type="text/css" href="${ctx}/assets/jqueryplugin/jquery-ui/jquery-ui.css" />
        <script type="text/javascript" src="${ctx}/assets/jqueryplugin/jquery-ui/jquery-ui.js"></script>
        <script type="text/javascript" src="${ctx}/static/js/manage/markingPaper/objective_list.js"></script>
        <style type="text/css">
		.input-group-addon {
		    width: 84px;
		    line-height: 20px;
		    height: 34px;
		    font-size: 12px;
		}
		.input-group {
		    position: relative;
		    display: inline-flex !important;
		    border-collapse: separate;
		    width: 360px;
		    margin-bottom: 5px;
		    line-height: 30px;
		    height: 34px;
		}
		.searchBtn {
		    height: 32px;
		    margin-bottom: 6px;
		}
		.imgPos{
			margin-bottom: 2px;
		}
			
		.ui-progressbar {
			position: relative;
		}
		.progress-label {
		    position: absolute;
		    left: 46%;
		    top: 35px;
		    font-weight: bold;
		    text-shadow: 1px 1px 0 #fff;
		    z-index: 100;
		}
		.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default{
		  	display:none;
		}
		.btn-sm, .btn-group-sm > .btn {
		    font-size: 12px;
		    line-height: 20px;
		    margin-bottom: 3px;
		}
        </style>
    </head>
    <body>
        <div class="clearfix"></div>
		<div class="row back-top-title">
			<div class="col-md-12">
				<span><spring:message code="app.markingPaper.title" /></span>
			</div>
		</div>
		
       	<div class="row">
			<div class="col-md-12">
				<div class="panel panel-white">
					<div class="panel-body">
						<form style="position:relative" id="splitPage" action="${ctx}/manage/markingPaper/objective" method="POST" role="form" class="form-horizontal">  
							<!-- search part -->
							<div id="toolbar" class="panel panel-default" style="margin:-5 0 -5 0;padding:0 0 0 0;">
								<div class="panel-body">
									<div class="form-inline" role="form">
										<div class="form-inline form-group">
											<div class="input-group" style="width: 230px;margin-bottom: 5px;">
												<span class="input-group-addon"><spring:message code="app.batch.title.mc" /></span>
												<select id="query_batch" name="query_batch" class="form-control" value="${batchId}" style="width:150px;margin-right: 10px;">
													<option value=""><spring:message code="app.common.title.select"/></option>
													<c:forEach var="item" items="${batchs}">
														<option value="${item.batchId}" <c:if test="${batchId==item.batchId}">selected="selected"</c:if>>${item.batchName}</option>
													</c:forEach>
												</select>
											</div>
											<div class="input-group" style="width: 230px;margin-bottom: 5px;">
												<span class="input-group-addon"><spring:message code="app.common.title.grade.mc" /></span>
												<select id="query_grade" name="query_grade" class="form-control" value="${gradeNo}" style="width:150px;margin-right: 10px;"></select>
											</div>
											<div class="input-group" style="width: 230px;margin-bottom: 5px;">
												<span class="input-group-addon"><spring:message code="app.common.title.course.mc" /></span>
												<select id="query_course" name="query_course" class="form-control" value="${courseNo}" style="width:150px;margin-right: 10px;"></select>
											</div>
											<button type="submit" class="fa fa-search btn btn-warning searchBtn"><spring:message code="app.common.action.search"/></button>
										</div>
									</div>
							  	</div>
							</div>
							<!-- table part -->
							<table id="dataTable" class="table table-striped table-bordered table-hover table-full-width">
	                            <thead>
	                                <tr>
	                                    <th><spring:message code="app.common.title.serial" /></th>
	                                    <th><spring:message code="app.courseTemplate.title.batchName" /></th>
	                                    <th><spring:message code="app.courseTemplate.title.gradeNo" /></th>
	                                    <th><spring:message code="app.courseTemplate.title.courseNo" /></th>
	                                    <th><spring:message code="app.markingPaper.title.single" /></th>
	                                    <th><spring:message code="app.markingPaper.title.multiple" /></th>
	                                    <th><spring:message code="app.common.title.status" /></th>
	                                    <th><spring:message code="app.common.action.operate" /></th>
	                                </tr>
	                            </thead>
	                            <tbody>
	                                <c:forEach items="${pagination.datas}" var="entity" varStatus="s">
	                                    <tr data-tempId="${entity.courseTemplateId}">
	                                        <td><c:out value="${s.index + 1}" /></td>
	                                        <td><c:out value="${entity.batchName}" /></td>
	                                        <td><c:out value="${entity.gradeName}" /></td>
	                                        <td><c:out value="${entity.courseName}" /></td>
	                                        <td>
		                                        <c:choose>
													<c:when test="${not empty entity.lx}">
													总分：${entity.tmzf} 分【单题：${entity.dtfz} 分，题数：${entity.tmsl} 题】
													</c:when>
													<c:otherwise><spring:message code="app.common.title.null"/></c:otherwise>
												</c:choose>
											</td>
	                                        <td>
												<c:choose>
													<c:when test="${not empty entity.lx2}">
													总分：${entity.tmzf2} 分【单题：${entity.dtfz2} 分，题数：${entity.tmsl2} 题】
													</c:when>
													<c:otherwise><spring:message code="app.common.title.null"/></c:otherwise>
												</c:choose>
											</td>
											<td>
												<c:choose>
													<c:when test="${not empty entity.lx or not empty entity.lx2}">
														<c:choose>
															<c:when test="${((not empty entity.lx and not empty entity.single) 
																or (not empty entity.lx2 and not empty entity.multiple)) and (entity.flag1=='true' or entity.falg2=='true')}">
																<spring:message code="app.markingPaper.title.already" />
																<img style="margin-bottom: 1px;vertical-align: middle;" title="<spring:message code="app.markingPaper.placeholder.already"/>" src="${yes_img}">
															</c:when>
															<c:when test="${(entity.single > 0 or entity.multiple > 0) 
																and ((entity.flag1=='false' and not empty entity.flag1) or (entity.falg2=='true' and not empty entity.flag2))}">
																<spring:message code="app.markingPaper.title.wait" />
																<img style="margin-bottom: 1px;vertical-align: middle;" title="<spring:message code="app.markingPaper.placeholder.wait"/>" src="${no_img}">
															</c:when>
															<c:otherwise>
																<spring:message code="app.common.title.null"/>
															</c:otherwise>
														</c:choose>
													</c:when>
													<c:otherwise><spring:message code="app.markingPaper.title.obj.null"/></c:otherwise>
												</c:choose>
											</td>
	                                        <td>
												<c:if test="${not empty entity.lx or not empty entity.lx2}">
													<c:choose>
														<c:when test="${((not empty entity.lx and not empty entity.single) 
																or (not empty entity.lx2 and not empty entity.multiple)) and (entity.flag1=='true' or entity.falg2=='true')}">
															<a title="<spring:message code="app.markingPaper.placeholder.restart"/>"
																class="fa fa-pencil btn btn-info btn-sm btn-restart">
																<spring:message code="app.markingPaper.action.restart" />
															</a>
															<a title="<spring:message code="app.markingPaper.placeholder.student.score"/>" 
																class="fa fa-file-alt btn btn-info btn-sm btn-view">
																<spring:message code="app.markingPaper.action.student.score" />
															</a>
														</c:when>
														<c:when test="${(entity.single > 0 or entity.multiple > 0) 
																and ((entity.flag1=='false' and not empty entity.flag1) or (entity.flag2=='true' and not empty entity.flag2))}">
															<a title="<spring:message code="app.markingPaper.placeholder.start"/>"
																class="fa fa-edit btn btn-info btn-sm btn-start">
																<spring:message code="app.markingPaper.action.start" />
															</a>
														</c:when>
													</c:choose>
												</c:if>
	                                        </td>
	                                    </tr>
	                                </c:forEach>
	                            </tbody>
	                        </table>
	                        <div class="row" id="splitPageDiv">
								<jsp:include page="/views/common/splitPage.jsp">
									<jsp:param value="mainPanel" name="divId"/>
									<jsp:param value="splitPage" name="formId"/>
									<jsp:param value="splitPageDiv" name="splitPageDiv"/>
								</jsp:include>
							</div>
						</form>
				    </div>
				</div>
			</div>
		</div>
		
		<div style="display:none;" id="dialog">
			<div id="progress-show-text" style="text-align:center;"></div>
			<div class="progress-label">开始执行自动阅卷...</div>
		  	<div id="progressbar"></div>
		</div>
    </body>
</html>
